<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        // 知识点
        //call stack  函数的调用栈
        // scope作用域
        //闭包是什么时候发生的

        //比如求数的平方根,立方根之类的
        function aa(router) {
            return function(number) {//闭包
                return Math.pow(number,router);
            }
        }
        let power2 = aa(2);// 求平方
        console.log(power2(5));
        let power3 = aa(3);//求立方
        console.log(power3(5));


        //比如求不同等级员工的工资
        function makeSalary (base) {//求工资 : 基本工资+绩效工资
            return (per) => {
                return base + per;
            }
        }
        let salaryLevel1 = makeSalary(8000);//等级1的基本工资是8000
        let salaryLevel2 = makeSalary(12000);//等级2的基本工资是12000
        console.log(salaryLevel1(3000));//求绩效是3000的等级1员工的工资
        

    </script>
</body>
</html>